Skip to content

Skip TTRESG104 diagnostic for interface properties#18

Merged
PawelGerr merged 1 commit intomasterfrom
claude/remove-interface-diagnostic-8eDBb
Feb 28, 2026
Merged

Skip TTRESG104 diagnostic for interface properties#18
PawelGerr merged 1 commit intomasterfrom
claude/remove-interface-diagnostic-8eDBb

Conversation

@PawelGerr
Copy link
Copy Markdown
Owner

Interfaces cannot have required members in C#, so the diagnostic
(and its code fix) should not fire for properties declared in interfaces.

https://claude.ai/code/session_01GfG47CpoCK1fMQ3E5D9wR6

Interfaces cannot have `required` members in C#, so the diagnostic
(and its code fix) should not fire for properties declared in interfaces.

https://claude.ai/code/session_01GfG47CpoCK1fMQ3E5D9wR6
Copilot AI review requested due to automatic review settings February 27, 2026 22:16
@github-actions
Copy link
Copy Markdown

tests results

    29 files  ±0      29 suites  ±0   39m 23s ⏱️ +43s
 6 501 tests +1   6 501 ✅ +1  0 💤 ±0  0 ❌ ±0 
20 512 runs  +3  20 512 ✅ +3  0 💤 ±0  0 ❌ ±0 

Results for commit a550145. ± Comparison against base commit 3b7a96f.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates TTRESG104 to avoid producing an invalid suggestion (required) for properties declared on interfaces, since interfaces can’t declare required members in C#.

Changes:

  • Skip TTRESG104 analysis for properties whose containing type is an interface.
  • Add an analyzer test case ensuring no diagnostic is reported for an interface property using a value object that disallows default values.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
test/Thinktecture.Runtime.Extensions.SourceGenerator.Tests/AnalyzerAndCodeFixTests/TTRESG104_MembersDisallowingDefaultValuesMustBeRequired.cs Adds regression test to ensure TTRESG104 does not trigger on interface properties.
src/Thinktecture.Runtime.Extensions.SourceGenerator/CodeAnalysis/Diagnostics/ThinktectureRuntimeExtensionsAnalyzer.cs Adds an early-return guard to skip TTRESG104 for interface-contained properties.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@PawelGerr PawelGerr merged commit c63960a into master Feb 28, 2026
15 checks passed
@PawelGerr PawelGerr deleted the claude/remove-interface-diagnostic-8eDBb branch February 28, 2026 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants